<?php
namespace app\api_wp_v01\controller;

class Recycle extends ApiWechatProgram {
	
	/**
	 * 获取用户地址
	 */
	public function get_address() {
		
		$field = array(
			'`recycle_address`.`id`', '`recycle_address`.`liaison_name`', '`recycle_address`.`address`',
		);
		$data_select = \app\common\model\RecycleAddressModel::field($field)
			->where('subscriber_id', $this->subscriber_id)
			->where('is_del', 0)
			->select();
			
		$data_list = array();
		foreach($data_select as $RecycleAddressModel){
			$data = array(
				'id' => $RecycleAddressModel->id,
				'name' => $RecycleAddressModel->liaison_name . ' ' . $RecycleAddressModel->address,
			);
			$data_list[] = $data;
		};
		
		return $this->disposeJson(0, '', array(
			'address_option' => $data_list
		));
	}
	
}